<?php
	class ClassA {
		
		private $secret;
		private $br = "<br/><br/><br/>";
		
		private function setSecret() {
			$this -> secret = "my secrets";
		}
		
		public function __construct() {
			echo "CALL ".__METHOD__.$this -> br;
			$this->setSecret();
		}
		
		public function __destruct() {
			echo "CALL ".__METHOD__.$this -> br;
		}
		
		public function __get($name) {
			echo "CALL __get: ".$name.$this -> br;
		}
		
		public function __set($name, $value) {
			echo "CALL __set: ".$name.",".$value.$this -> br;
		}
		
		public function __call($name, $args) {
			echo "CALL __call: ".$name.",".print_r($args, true).$this -> br;
		}
		
		public function __sleep() {
			echo "CALL ".__METHOD__.$this -> br;
			$this -> secret = "unknown";
			return array("secret");
		}
		
		public function __wakeup() {
			echo "CALL ".__METHOD__.$this -> br;
			$this -> setSecret();
		}
	}
	
	$a = new ClassA();
	$a -> attrA = "value A";
	echo $a -> attrA;
	echo $a -> attrB;
	$a -> hello(1, 2, 3);
	$b = serialize($a);
	var_dump($b);
	$c = unserialize($b);
	var_dump($c);
?>